#!/bin/sh
name=$1
pid=$2
while(true)
do
line="----------------------------------------------------------"
line2="##########################################################"
time3=$(date "+%Y-%m-%d %H:%M:%S")
vmstat=`vmstat`
cpuinfo=`top -b -n1 | fgrep "Cpu(s)" -C 8`
mem=`free -h`
nvideia=`nvidia-smi`
# info=`echo  "\n${line}\n${time3}\n${vmstat}\n${line2}\n${cpuinfo}\n${mem}\n${nvideia}"`
info=`echo  "{'line':'${line}','time3':'${time3}','vmstat':'${vmstat}','line2':'${line2}','cpuinfo':'${cpuinfo}','mem':'${mem}','nvideia':'${nvideia}'}"`
cat >> info.log <<EOF
 ${info}
EOF
     sleep 1s
done
